/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package JavaView;

import Model.ChoreBean;
import Model.UserBean;
import dao.ChoreDAO;
import dao.ChoreListDAO;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.context.FacesContext;

/**
 *
 * @author amkreuz
 */
@Named(value = "choreView")
@SessionScoped
public class ChoreView implements Serializable {

    
    /**
     * Creates a new instance of ChoreView
     */
    public ChoreView() {
        
    }
    
    public String viewChore() {
        String response = "";
        response += "<h:commandButton value=\"Test\" action=\"#{choreView.viewChore()}\" />";
        /*
        try {
            ChoreListDAO.init();
            UserBean user = (UserBean) FacesContext.getCurrentInstance().
                    getExternalContext().getSessionMap().get("userBean");
            List<ChoreBean> list = ChoreListDAO.getChores(user.getHouseName());
            
            for (ChoreBean cb: list) {
                response += "<h2>"+cb.getChoreName()+"</h2>"+"<h:commandButton value=\"Test\"></h:commandButton>";
            }
            response += "<h:commandButton value=\"Test\"></h:commandButton>";
            ChoreDAO.terminate();
        } catch (SQLException ex) {
            Logger.getLogger(ChoreView.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        */
        
        return response;
    }
}
